﻿using Microsoft.AspNetCore.Mvc;
using Nasty.Core.LoadParams;
using Nasty.Core.Registry;
using Nasty.FlowModule.Areas.FlowTest.Model;
using Nasty.FlowModule.Areas.FlowTest.Params;
using NetTaste;

namespace Nasty.FlowModule.FlowTest
{
	public interface IFlowTestService : IAutofacRegister
	{
		public FlowTest GetFlowTest(string id);

		public List<FlowTest> GetFlowTests(GetFlowTestsParams @params);

        public ResultData<FlowTest> SaveFlowTest(FlowTestModel model);

		public ResultData<string> DeleteFlowTests(List<string> ids);

        public PageData<FlowTest> GetFlowTestPage(GetFlowTestPageParams @params);
    }

	public class FlowTestService : IFlowTestService
	{
		public required IFlowTestRepository FlowTestRepository { get; set; }

		public ResultData<string> DeleteFlowTests(List<string> ids)
		{
			return FlowTestRepository.DeleteFlowTests(ids);
		}

        public PageData<FlowTest> GetFlowTestPage(GetFlowTestPageParams @params)
        {
            return FlowTestRepository.GetFlowTestPage(@params);
        }

        public FlowTest GetFlowTest(string id)
		{
			return FlowTestRepository.GetFlowTest(id);
		}

		public ResultData<FlowTest> SaveFlowTest(FlowTestModel model)
		{
			return FlowTestRepository.SaveFlowTest(model);
		}

        public List<FlowTest> GetFlowTests(GetFlowTestsParams @params)
        {
            return FlowTestRepository.GetFlowTests(@params);
        }
    }
}
